package com.example.replacebooks.mapper;

import com.example.replacebooks.entity.Bookinfo;
import com.example.replacebooks.entity.Changebook;
import com.example.replacebooks.entity.Params;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

@Repository
public interface ChangebookMapper extends Mapper<Changebook> {
    List<Changebook> findBySearch(@Param("params") Params params);

    @Select("select * from changebook where changebookid = #{changebookid} limit 1")
    Changebook findByChangebookid(@Param("changebookid") Integer changebookid);

    @Select("select * from changebook where changebookid = #{changebookid}")
    List<Changebook> findByChangebookids(@Param("changebookid") Integer changebookid);

    @Update("update changebook set changeaddress=#{changeaddress},address=#{address},changeimg=#{changeimg},changestatu = #{changestatu},time = #{time},changetime = #{changetime},bookid = #{bookid},changename = #{changename},changedegree = #{changedegree},changeISBN = #{changeisbn} where changebookid = #{changebookid}")
    void updateBybookid(Changebook changebook);

    List<Changebook> findByStatuSearch(@Param("params") Params params);
}

